home *** CD-ROM | disk | FTP | other *** search
- /*
- File: OTARPModule.h
-
- Contains: Types and constants to interface to the OT ARP module.
-
- Written by: Quinn "The Eskimo!"
-
- Copyright: Copyright © 1997-1999 by Apple Computer, Inc., All Rights Reserved.
-
- You may incorporate this Apple sample source code into your program(s) without
- restriction. This Apple sample source code has been provided "AS IS" and the
- responsibility for its operation is yours. You are not permitted to redistribute
- this Apple sample source code as "Apple sample source code" after having made
- changes. If you're going to re-distribute the source, we require that you make
- it clear in the source that the code was descended from Apple sample source
- code, but that you've made changes.
-
- Change History (most recent first):
- 7/21/1999 Karl Groethe Updated for Metrowerks Codewarror Pro 2.1
-
-
- */
-
- #if PRAGMA_ALIGN_SUPPORTED
- #pragma options align=mac68k
- #endif
-
- ///////////////////////////////////////////////////////////////////
-
- // Pick up the standard UInt32 types.
-
- #include <Types.h>
-
- // Pick up the MIOC_CMD macro.
-
- #include <OpenTransport.h>
-
- // Pick up queue_t.
-
- #include <mistream.h>
-
- // Pick up the MIOC_ARP constants.
-
- // #include <miioccom.h>
-
- // This constant is actually defined in <miioccom.h>, but
- // commented out for some reason )-:
-
- #define MIOC_ARP 'h' /* ioctl's for Mentat's arp module */
-
- ///////////////////////////////////////////////////////////////////
-
- // ARP Command Structures
-
- // arc_t is the standard header for all ARP command structures.
- // The structure you should use is determined by the arc_cmd
- // field. See the command constants for details of which
- // structures to use with which commands..
-
- typedef struct {
- UInt32 arc_cmd;
- UInt32 arc_name_offset;
- UInt32 arc_name_length;
- UInt32 arc_proto;
- UInt32 arc_proto_addr_offset;
- UInt32 arc_proto_addr_length;
- UInt32 arc_flags;
- queue_t * arc_client_q; /* context save area for client module */
- } arc_t;
-
- typedef struct {
- arc_t area_arc;
- UInt32 area_proto_mask_offset;
- UInt32 area_hw_addr_offset;
- UInt32 area_hw_addr_length;
- } area_t;
-
- typedef struct {
- arc_t areq_arc;
- UInt32 areq_sender_addr_offset;
- UInt32 areq_sender_addr_length;
- UInt32 areq_xmit_count; /* 0 ==> cache lookup only */
- UInt32 areq_xmit_interval; /* # of milliseconds; 0: default */
- UInt32 areq_max_buffered; /* # ofquests to buffer; 0: default */
- UInt8 areq_sap[8]; /* to insert in returned template */
- } areq_t;
-
- typedef struct {
- arc_t arma_arc;
- UInt32 arma_proto_mask_offset;
- UInt32 arma_proto_extract_mask_offset;
- UInt32 arma_hw_addr_offset;
- UInt32 arma_hw_addr_length;
- UInt32 arma_hw_mapping_start; /* Offset to start of the mask&proto_addr */
- } arma_t;
-
-
- // ARP Command Codes for use in the arc_cmd field of arc_t,
- // along with the true structures you should use.
-
- #define AR_ENTRY_ADD MIOC_CMD(MIOC_ARP,1)
- // Add an ARP cache entry.
- // Use area_t structure.
- // In:
- // area_arc.arc_cmd = AR_ENTRY_ADD
- // area_arc.arc_name_offset = offset to name of interface
- // area_arc.arc_name_length = length of name of interface (including zero terminator)
- // area_arc.arc_proto = ARP protocol type (eg IP_ARP_PROTO_TYPE)
- // area_arc.arc_proto_addr_offset = offset to protocol address to look up (eg an InetHost)
- // area_arc.arc_proto_addr_offset = length of protocol address to look up (eg sizeof(InetHost))
- // area_arc.arc_flags = flags for this cache entry (see below)
- // area_proto_mask_offset = offset to a protocol address mask (usually $FFFFFFFF)
- // area_hw_addr_offset = offset to hardware address
- // area_hw_addr_length = length of hardware address (eg 6)
-
- #define AR_MAPPING_ADD MIOC_CMD(MIOC_ARP,7)
- // Use arma_t structure.
-
- #define AR_ENTRY_DELETE MIOC_CMD(MIOC_ARP,2)
- // Delete an entry in the ARP cache.
- // Use arc_t structure.
- // In:
- // arc_cmd = AR_ENTRY_DELETE
- // arc_name_offset = offset to name of interface
- // arc_name_length = length of name of interface (including zero terminator)
- // arc_proto = ARP protocol type (eg IP_ARP_PROTO_TYPE)
- // arc_proto_addr_offset = offset to protocol address to delete (eg an InetHost)
- // arc_proto_addr_length = length of protocol address to delete (eg sizeof(InetHost))
-
- #define AR_ENTRY_QUERY MIOC_CMD(MIOC_ARP,3)
- // Look for an entry, either in the cache or by talking on the network.
- // Use areq_t structure.
- // In:
- // areq_arc.arc_cmd = AR_ENTRY_QUERY
- // areq_arc.arc_name_offset = offset to name of interface
- // areq_arc.arc_name_length = length of name of interface (including zero terminator)
- // areq_arc.arc_proto = ARP protocol type (eg IP_ARP_PROTO_TYPE)
- // areq_arc.arc_proto_addr_offset = offset to protocol address to look up (eg an InetHost)
- // areq_arc.arc_proto_addr_offset = length of protocol address to look up (eg sizeof(InetHost))
- // areq_sender_addr_offset = offset to protocol address of sender (eg an InetHost)
- // areq_sender_addr_length = length of protocol address of sender (eg sizeof(InetHost))
- // areq_xmit_count = number of transmissions before giving up (use 0 for a straight cache lookup)
- // areq_xmit_interval = number of milliseconds between transmissions (0 gives a sensible default)
- // areq_max_buffered = number of requests to buffer (0 gives a sensible default)
- // areq_sap = a SAP to insert into the returned response
- // Out:
- // The output is in the form of a DLPI message that you can
- // use as the header to a message to the requested host.
-
- #define AR_ENTRY_SQUERY MIOC_CMD(MIOC_ARP,6)
- // Look for an entry in the ARP cache.
- // Use area_t structure.
- // In:
- // area_arc.arc_cmd = AR_ENTRY_SQUERY
- // area_arc.arc_name_offset = offset to name of interface
- // area_arc.arc_name_length = length of name of interface (including zero terminator)
- // area_arc.arc_proto = ARP protocol type (eg IP_ARP_PROTO_TYPE)
- // area_arc.arc_proto_addr_offset = offset to protocol address to look up (eg an InetHost)
- // area_arc.arc_proto_addr_offset = length of protocol address to look up (eg sizeof(InetHost))
- // area_hw_addr_offset = offset to buffer to store hardware address
- // area_hw_addr_length = length of buffer to store hardware address (eg 6)
- // Out:
- // area_arc.arc_flags = flags for this entry
- // buffer pointed to by area_hw_addr_offset and area_hw_addr_length = hardware address
-
- #define AR_XMIT_REQUEST MIOC_CMD(MIOC_ARP,4)
- // Use arc_t structure.
-
- #define AR_XMIT_RESPONSE MIOC_CMD(MIOC_ARP,11)
- // Use arc_t structure.
-
- #define AR_INTERFACE_UP MIOC_CMD(MIOC_ARP,9)
- // Bring an ARPing interface up.
- // Use arc_t structure.
- // In:
- // arc_cmd = AR_INTERFACE_UP
- // arc_name_offset = offset to name of interface
- // arc_name_length = length of name of interface (including zero terminator)
-
- #define AR_INTERFACE_DOWN MIOC_CMD(MIOC_ARP,10)
- // Tear an ARPing interface down.
- // Use arc_t structure.
- // In:
- // arc_cmd = AR_INTERFACE_DOWN
- // arc_name_offset = offset to name of interface
- // arc_name_length = length of name of interface (including zero terminator)
-
-
- // Flags used in the arc_flags field of arc_t.
-
- #define ACE_F_PERMANENT 0x1 // This entry will not time out.
- #define ACE_F_PUBLISH 0x2 // ARP will respond to incoming ARP requests for this entry
- #define ACE_F_DYING 0x4 // This entry is going away very soon.
- #define ACE_F_RESOLVED 0x8 // This entry is valid.
- #define ACE_F_MAPPING 0x10 // Use bit mask on target address.
-
- // The protocol value for IP ARPs, for use in the arc_proto field of the arc_t.
-
- #define IP_ARP_PROTO_TYPE 0x0800
-
-
- #if PRAGMA_ALIGN_SUPPORTED
- #pragma options align=reset
- #endif
-